﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ClientRegister
{
    public partial class AddSubjectForm : Form
    {

        SynchronizeData sync = new SynchronizeData();

        GetNextID getID = new GetNextID();

        public AddSubjectForm()
        {
            InitializeComponent();
        }

        private void AddSubjectForm_Load(object sender, EventArgs e)
        {
            ////Load du lieu tu server
            //sync.GetDataForInsertMethodWithID(sync.SubTb, sync.insertcol);
        }

        private void btnCreate_Click(object sender, EventArgs e)
        {
            //string xml = "";
            SubjectsDataProvider addsub = new SubjectsDataProvider();
            string lastID = getID.getLastID(getID.SubjectTB, getID.IDCol);
            string ID = getID.NextID(lastID, getID.prefixID);
            int result = addsub.AddSub(ID,txtName.Text);
            if (result != 0)
            {
                ////Chuyen du lieu mon hoc len server
                //xml = addsub.SelectAndConvertXMLSub(idsub);
                //sync.transfDataForInsertMethod(xml, sync.SubTb);

                MessageBox.Show("Đã thêm môn học");
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
